Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Invoking the
@EventBusSubscriber.Condition
method suffered from the same reflection problems as described in #80, which is that it will have to load the entire method table including parameters classes that might not be present.Having to dynamically invoke a given method without reflection only leaves a few options, which are either using
MethodHandle
which are generally faster than reflection if invoked a ton of times but significantly slower if only invoked onceor using the semi-obscure
LambdaMetafactory
api. This generates a synthetic anonymous class that implements a functional interface to get a value from the specified method, while that might sound like it would be a lot slower than reflection it was in fact consistently faster and doesn't have to load the entire method table.Makes
@EventBusSubscriber
's able to be registered during earlier init phases as some events are fired during pre-init, specifically some of the registry events. This means that if an@EventBusSubscriber
wants to listen to that event and potentially pick up something that gets fired during the pre-init phase of a mod that loads earlier than NHLib, it would have to be registered during the construction phase. This is only applicable in very few cases but I thought it'd be best to at least make it an option.Also some different minor improvements like using
ASMDataTable.getAll
to get the side-only classes instead ofASMDataTable.getAnnotationsFor
. This alone lowered the time it took for that part of the pre-proccesing from ~90ms to ~5-15ms on my GT5U test branch, and that was while only ever usingASMDataTable.getAnnotationsFor
twice...